package com.swjd.controller;

import com.swjd.pojo.Concern;
import com.swjd.service.impl.ConcernServiceImpl;
import com.swjd.util.BecomeJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by hxl on 2019/5/31  9:11
 */
@Controller
@RequestMapping(value = "action/", method = RequestMethod.POST)
public class ConcernController {
    @Autowired
    private ConcernServiceImpl concernService;

    @ResponseBody
    @RequestMapping("selectConcern")//根据用户名查询用户关注的其他用户
    public List<String> selectConcern(@RequestParam("username") String username) {
        return concernService.selectConcern(username);
    }

    @ResponseBody
    @RequestMapping("selectFans")//查询用户的粉丝
    public List<String> selectFans(@RequestParam("concernName") String concernName) {
        return concernService.selectFans(concernName);
    }

    @ResponseBody
    @RequestMapping("deleteConcernName")//取消关注
    public String deleteConcernName(@RequestBody Concern concern) {
        return BecomeJson.isOk(concernService.deleteConcernName(concern));
    }
}
